package raft.service;

import raft.entity.*;
import raft.node.NodeConfig;

public interface Node<T> extends LifeCycle {


    /**
     * 设置配置文件
     * @param config
     */
    void setConfig(NodeConfig config);


    /**
     * 处理投票请求
     * @param param
     * @return
     */
     RvoteResult handleReqVote(RvoteParam param);

    /**
     * 处理附加日志请求
     * @param param
     * @return
     */
     AentryResult handleAppendEntries(AentryParam param);

    /**
     * 处理客户端请求.
     *
     * @param request
     * @return
     */
    ClientKVAck handlerClientRequest(ClientKVReq request);

    /**
     * 转发给 leader 节点.
     * @param request
     * @return
     */
    ClientKVAck redirect(ClientKVReq request);




}
